package edu.nf.project.webs.employeeAndCustomerInformation;

import edu.nf.project.services.employeeAndCustomerInformation.CustomerInfo_CouponService;
import edu.nf.project.services.exception.derivedAnomalies.UsersException;
import edu.nf.project.services.response.BaseController;
import edu.nf.project.services.response.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/cus-cou")
public class CustomerInfo_CouponController extends BaseController {
    @Autowired
    private CustomerInfo_CouponService customerInfoCouponService;

    @DeleteMapping("/useCoupon")
    public ResultVO<Boolean> getUserNewPoint(@RequestParam Integer customerId, @RequestParam Integer couponId) {
        try{
            return success(customerInfoCouponService.useCoupon(customerId, couponId));
        }catch (Exception e){
            System.out.println(e);
            throw new UsersException(10000, "系统错误，请稍后重试");
        }
    }
}
